<template>
  <div class="container">
    <item v-for="item of more" :key="item.id" :data="item" @click.native="toDetail(item.id)"></item>
  </div>
</template>

<script>
export default {
  data() {
    return {
      more:[]
    }
  },
  mounted() {
    // console.log(this.$route.query);
    var {title} = this.$route.query;
    if (title === "热门歌曲") {
      this.$http("http://47.108.197.28:3000/top/playlist/highquality").then(
        (res) => {
          res.data.playlists.forEach((item) => {
            var { coverImgUrl } = item;
            item.picUrl = coverImgUrl;
          });
          this.more = res.data.playlists.slice(3,);
        }
      );
    } else if (title === "最新音乐") {
      this.$http("http://47.108.197.28:3000/album/newest").then((res) => {
        this.more = res.data.albums.slice(3,);
      });
    } else if (title === "主播电台") {
      this.$http("http://47.108.197.28:3000/personalized/djprogram").then(
        (res) => {
          this.more = res.data.result.slice(3,);
        }
      );
    }
  },
  methods: {
    toDetail(val){
      this.$router.push(`./musicDetail/${val}`)
    }
  },
}
</script>

<style>

</style>